<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div>你哈</div>
    <button class="btn1">存储</button>
    <button class="btn">删除</button>
    <button class="btn3">获取</button>
    <script>

        const localStorageFactory = (params) => {
            const { key, defalutValue } = params;
            const getItem = () => JSON.parse(localStorage.getItem(key) || defalutValue);
            const setItem = (value) => localStorage.setItem(key, JSON.stringify(value || defalutValue));
            const removeItem = () => localStorage.removeItem(key);
            return [
                getItem,
                setItem,
                removeItem
            ]
        }

    </script>
    <script>

        // const btn1 = document.querySelector('.btn1')
        // const btn2 = document.querySelector('.btn2')
        // const btn3 = document.querySelector('.btn3');
        // const obj = {
        //     a: '哈哈'
        // }
        // btn1.onclick = function () {

        // }
    </script>
</body>

</html>